Customizing the Recording Process

You can customize the recording process, taking complete control of most everything   from creating the MCIWnd window to saving the recorded information in a file. The following example queries the MCI device for recording and saving capabilities, and includes menu commands to record at the beginning or end of the content.

The following example uses the MCIWndCreate_T_JCT function to create a new window and allows you to specify an existing file to store the recorded data and the MCIWndNew1Y3SUEO macro to associate a new file with the window. Alternatively, you can use the MCIWndOpenF.J2CX or MCIWndOpenDialog1ZI4_N4 macro to specify a file.

The example uses the MCIWndCanRecord4.ZAOL macro to verify that the device can record and the MCIWndCanSaveGBO9WB macro to verify that the device save information. The example sets the current playback position by using the MCIWndHomeF.C1KO and MCIWndEnd1Y3SLN. macros. The example starts recording by using the MCIWndRecord2N84W1X macro. After the information is recorded, the example saves it by using the MCIWndSaveDialogHUM4W9 macro.

case WM_COMMAND:

    switch (wParam)

   

        case IDM_CREATEMCIWND:

            g_hwndMCIWnd = MCIWndCreate( hwnd, g_hinst,

                WS_VISIBLE | WS_CHILD |

                MCIWNDF_RECORD,                   // add Record button

                NULL );

 

            MCIWndNew(g_hwndMCIWnd, "waveaudio"); // new file

 

            if( MCIWndCanRecord(g_hwndMCIWnd) )

           

                MessageBox( hwnd,

                "Press the red button on the toolbar to record.",

                "MCIWnd Record",

                MB_OK );

            }

            else

           

                MessageBox( hwnd,

                    "This device doesn't record.",

                    "MCIWnd Record",

                    MB_OK );

            }

            break;

        case IDM_RECORDATSTART:

            if( MCIWndCanRecord(g_hwndMCIWnd) )

           

                MCIWndHome(g_hwndMCIWnd);

                MCIWndRecord(g_hwndMCIWnd);

            }

            else

           

                MessageBox( hwnd,

                    "This device doesn't record.",

                    "MCIWnd Record",

                    MB_OK);

            }

            break;

        case IDM_RECORDATEND:

            if( MCIWndCanRecord(g_hwndMCIWnd) )

           

                MCIWndEnd(g_hwndMCIWnd);

                MCIWndRecord(g_hwndMCIWnd);

            }

            else

           

                MessageBox( hwnd,

                    "This device doesn't record.",

                    "MCIWnd Record",

                    MB_OK);

            }

            break;

        case IDM_SAVEMCIWND:

            if( MCIWndCanSave(g_hwndMCIWnd) )

                MCIWndSaveDialog(g_hwndMCIWnd);

    }

    break;

 

    // Handle other messages here.